package com.geline.sqlbackup.bean;

import java.io.Serializable;
import java.util.List;

/**
 * @author mengx
 * @version 2020/12/2 15:10
 */
public class TableColumnInfo implements Serializable {

    private String author = "www.95coder.com";//不需要传入
    private String dbType;
    private String entityName;
    private String tableName;
    private String tableComment;
    private List<ColumnInfo> columnInfoList;
    //字典类型列表
    private List<String> dictTypeList;

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public String getDbType() {
        return dbType;
    }

    public void setDbType(String dbType) {
        this.dbType = dbType;
    }

    public String getEntityName() {
        return entityName;
    }

    public void setEntityName(String entityName) {
        this.entityName = entityName;
    }

    public String getTableName() {
        return tableName;
    }

    public void setTableName(String tableName) {
        this.tableName = tableName;
    }

    public String getTableComment() {
        return tableComment;
    }

    public void setTableComment(String tableComment) {
        this.tableComment = tableComment;
    }

    public List<ColumnInfo> getColumnInfoList() {
        return columnInfoList;
    }

    public void setColumnInfoList(List<ColumnInfo> columnInfoList) {
        this.columnInfoList = columnInfoList;
    }

    public List<String> getDictTypeList() {
        return dictTypeList;
    }

    public void setDictTypeList(List<String> dictTypeList) {
        this.dictTypeList = dictTypeList;
    }

    public ColumnInfo getPrimaryKey() {
        if(this.columnInfoList != null && this.columnInfoList.size()>0){
            for(ColumnInfo columnInfo : columnInfoList){
                if(columnInfo.isPrimaryKey()){
                    return columnInfo;
                }
            }
        }
        return null;
    }
}
